﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Dapper;
using Dapper.Database;
using Dapper.Database.Extensions;
using ExpressionExtensionSQL;
using ExpressionExtensionSQL.Dapper;
namespace QuickFramework.Orm
{
    public partial interface IRepository
    {
        bool Delete<T>(Expression<Func<T, bool>> expression
                                   , IUnitOfWork unitOfWork = null
                                   , int? commandTimeout = null) where T : Shared.Contracts.EntityBase;

        Task<bool> DeleteAsync<T>(Expression<Func<T, bool>> expression
                                                , IUnitOfWork unitOfWork = null
                                                , int? commandTimeout = null) where T : Shared.Contracts.EntityBase;

        bool Exists<T>(Expression<Func<T, bool>> expression
                                           , IUnitOfWork unitOfWork = null
                                           , int? commandTimeout = null) where T : Shared.Contracts.EntityBase;

        Task<bool> ExistsAsync<T>(Expression<Func<T, bool>> expression
                                                , IUnitOfWork unitOfWork = null
                                                , int? commandTimeout = null) where T : Shared.Contracts.EntityBase;

        IEnumerable<T> Find<T>(Expression<Func<T, bool>> expression
                             , IUnitOfWork unitOfWork = null
                             , int? commandTimeout = null) where T : Shared.Contracts.EntityBase;
        Task<IEnumerable<T>> FindAsync<T>(Expression<Func<T, bool>> expression
                               , IUnitOfWork unitOfWork = null
                               , int? commandTimeout = null) where T : Shared.Contracts.EntityBase;

        IEnumerable<T> Where<T>(Expression<Func<T, bool>> expression
                         , IUnitOfWork unitOfWork = null
                         , int? commandTimeout = null) where T : Shared.Contracts.EntityBase;
        Task<IEnumerable<T>> WhereAsync<T>(Expression<Func<T, bool>> expression
                                   , IUnitOfWork unitOfWork = null
                                   , int? commandTimeout = null) where T : Shared.Contracts.EntityBase;
        T FirstOrDefault<T>(Expression<Func<T, bool>> expression
                             , IUnitOfWork unitOfWork = null
                             , int? commandTimeout = null) where T : Shared.Contracts.EntityBase;
        Task<T> FirstOrDefaultAsync<T>(Expression<Func<T, bool>> expression
                                       , IUnitOfWork unitOfWork = null
                                       , int? commandTimeout = null) where T : Shared.Contracts.EntityBase;
    }
}
